package com.yxx.controller;

import com.yxx.entityModel.vo.Result.ResponseResult;
import com.yxx.service.BilibiliService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * B站服务模块
 * @author yuxiangxun
 * @date 2025/2/1
 * @apiNote
 */
@RestController
@Slf4j
@Api(tags = "B站服务模块")
public class BiliBiliController {
    @Resource
    private BilibiliService bilibiliService;

    /**
     * 上传图片到B站
     * @param file
     * @param csrf
     * @param data
     * @return
     */
    @ApiOperation(value = "上传图片到B站")
    @PostMapping("/bili/upload")
    public ResponseResult<String> bilibiliUpload(@RequestParam("file_up")MultipartFile file,
                                                 @RequestParam(value = "csrf") String csrf,
                                                 @RequestParam(value = "data") String data){
        return ResponseResult.success(bilibiliService.uploadBilibiliPicture(file,csrf,data));
    }
}
